package Admin.servlet;

import Admin.entity.Admin;
import Admin.service.AdminService;
import Admin.service.impl.AdminServiceImpl;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author chenle
 * @version 1.0
 * @date 2023/10/8 9:06
 */
@WebServlet("/AdminUpTopServlet")
public class AdminUpTopServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String ldStr=request.getParameter("id");
        int id=ldStr!=null?Integer.parseInt(ldStr):0;

        AdminService service=new AdminServiceImpl();
        Admin admin=new Admin();

        admin.setId(id);
        int count=service.updateTop(admin);

        PrintWriter out=response.getWriter();
        out.print(count);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        
    }
}
